package com.faya.green.controller.user;

import com.faya.green.abnormal.ControllerException;
import com.faya.green.abnormal.ServiceException;
import com.faya.green.common.Constant;
import com.faya.green.controller.BaseController;
import com.faya.green.dao.user.ResumeDao;
import com.faya.green.enumeration.ResultEnum;
import com.faya.green.model.*;
import com.faya.green.service.*;
import com.faya.green.utils.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.gson.Gson;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.*;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.util.ClassUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 用户 ：LX
 * 创建时间： 2018/7/10. 22:55
 * 地点：广州
 * 目的: 用户相关的控制层
 * 结果：
 */
@Controller
@RequestMapping("/user")
public class UserController extends BaseController {

    @Autowired
    private UserService userService;
    @Autowired
    private PostService postService;
    @Autowired
    private BaseInfoService baseInfoService;
    @Autowired
    private CommendService commendService;
    @Autowired
    private PunishService punishService;
    @Autowired
    private ResumeService resumeService;
    @Autowired
    private UserImgService userImgService;
    @Autowired
    private SubsidiaryUserService subsidiaryUserService;
    @Autowired
    private OrganizationService organizationService;
    @Autowired
    private RelationshipService relationshipService;


    /**
     * 获取附属子用户的详情信息
     * @param sonUserId 附属子用户主键
     * @param type 操作类型 1 详情查看  2  修改数据的回显  无用字段
     * @return
     */
    @RequestMapping(value = "/showingSonUserDetails.php", method = RequestMethod.GET)
    @ResponseBody
    public ResultJson showingSonUserDetails(String sonUserId, String type){
        try {

            if (CommonUtils.checkNull(sonUserId)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "没有用户ID", null);
            }

            Map<String, Object> map = new HashMap();
            SubsidiaryUser subsidiaryUser = subsidiaryUserService.getSubsidiaryUserById(sonUserId);
            if (subsidiaryUser != null){

                //如果是该类型要进行数据回显出来
                String ethnic = subsidiaryUser.getEthnic();
                if (!CommonUtils.checkNull(ethnic)){
                    if("-1".equals(ethnic)){
                        subsidiaryUser.setEthnicStr("");
                    } else {
                        BaseInfo baseinfoEthnic = baseInfoService.getBaseInfoById(ethnic);
                        if (baseinfoEthnic != null){
                            subsidiaryUser.setEthnicStr(baseinfoEthnic.getKey());
                        }
                    }
                }

                //获取关系，得到他的父级关系
                Relationship relationship = relationshipService.getRelationshipBySonId(subsidiaryUser.getId());
                map.put("relationship", relationship);

                if (relationship != null){
                    String father = relationship.getFather();
                    SubsidiaryUser fatherSub = subsidiaryUserService.getSubsidiaryUserById(father);
                    if (fatherSub == null){
                        //如果在附属表查询不到，可能该用户是主用户
                        User user = userService.getUserById(father);
                        fatherSub = new SubsidiaryUser();
                        //转换为子用户
                        fatherSub.setId(user.getId());
                        fatherSub.setName(user.getName());
                        fatherSub.setSex(user.getSex());
                        fatherSub.setBirthday(user.getBirthday());
                        fatherSub.setEthnic(user.getEthnic());
                        fatherSub.setProvince(user.getProvince());
                        fatherSub.setCity(user.getCity());
                        fatherSub.setCounty(user.getCounty());
                        fatherSub.setAddDetails(user.getAddDetails());
                        fatherSub.setSchool(user.getSchool());
                        fatherSub.setProfession(user.getProfession());
                        fatherSub.setImgHred(user.getImgHred());
                        fatherSub.setEmail(user.getEmail());
                        fatherSub.setIsParty(user.getIsParty());
                        fatherSub.setAddParty(user.getAddParty());
                        fatherSub.setCreateTime(user.getCreateTime());
                        fatherSub.setUpdateTime(user.getUpdateTime());
                        fatherSub.setStatus(user.getStatus());
                        fatherSub.setRemark(user.getRemark());
                    }

                    map.put("fatherSub", fatherSub);
                }
            }

            map.put("subsidiaryUser", subsidiaryUser);


            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "获取子用户详情成功", map);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "获取子用户详情失败", null);
        }
    }

    /**
     * 获取用户头像图片
     * @param id 图片的id
     * @param response
     */
    @RequestMapping("/getImgHred")
    public void getImgHred(String id, HttpServletResponse response){
        if (CommonUtils.checkNull(id)){
            //获取到资源路径
            String path = ClassUtils.getDefaultClassLoader().getResource("").getPath();
            String defaulImgPath = path + "static/img/common/worker.png";
            ImgUtils.imgOut(response, defaulImgPath);

        } else {
            ImgUtils.readImg(id, response, "imgHred", null);
        }
    }

    /**
     * 获取附属用户头像图片
     * @param id 图片的id
     * @param response
     */
    @RequestMapping("/getSonImgHred")
    public void getSonImgHred(String id, HttpServletResponse response){
        ImgUtils.readImg(id, response, "subsidiaryUserImg", null);
    }


    /**
     * 用户登录
     * @param user 用户信息
     * @param rememberMe 对应前端的记住我checkbox name，如果不加可以
     * @return
     */
    @RequestMapping(value = "/loginUser", method = RequestMethod.POST)
    @ResponseBody
    public ResultJson loginUser(User user, HttpServletRequest request, boolean rememberMe){
        ResultJson resultJson = new ResultJson();

        if (user == null){
            resultJson.setMsg("请输入账号密码");
            resultJson.setStatus(ResultEnum.RESULT_ERROR.getStatus());
            return resultJson;
        }

        if (CommonUtils.checkNull(user.getPassword()) || CommonUtils.checkNull(user.getLogName())){
            resultJson.setMsg("账号或密码为空");
            resultJson.setStatus(ResultEnum.RESULT_ERROR.getStatus());

            //TODO 这里应该改为直接"redirect:/loginSuccess" ，而不是这么返回，虽然也没问题
            return resultJson;
        }

        //验证码,如果这里使用session来管理的话，需要注意检查完之后立刻对session中的验证码清除，想做单独每个用户验证码时间不同的方案，考虑加入redis
        String verifyCode = (String)request.getSession().getAttribute(Constant.VERIFY_CODE);
        String verify = request.getParameter("verifyCode");
        if (CommonUtils.checkNull(verify) || CommonUtils.checkNull(verifyCode)){
            resultJson.setMsg("验证码不能为空或已失效");
            resultJson.setStatus(ResultEnum.RESULT_ERROR.getStatus());
            request.getSession().removeAttribute(Constant.VERIFY_CODE);
            return resultJson;
        }

        if (!verify.toUpperCase().equals(verifyCode.toUpperCase())){
            resultJson.setMsg("验证码错误");
            resultJson.setStatus(ResultEnum.RESULT_ERROR.getStatus());
            request.getSession().removeAttribute(Constant.VERIFY_CODE);
            return resultJson;
        } else {
            //一旦验证通过，那么将这个验证码删除
            request.getSession().removeAttribute(Constant.VERIFY_CODE);
        }


        //如果是没有记住我，直接使用下面的代码即可，有记住我功能，则要将 rememberMe 放进去
        //UsernamePasswordToken token = new UsernamePasswordToken(user.getLogName(), user.getPassword());
        UsernamePasswordToken token = new UsernamePasswordToken(user.getLogName(), user.getPassword(), rememberMe);
        Subject subject = SecurityUtils.getSubject();

        try {
            subject.login(token);
            resultJson.setMsg("登录认证成功");
            resultJson.setStatus(ResultEnum.RESULT_SUCCESS.getStatus());
            return resultJson;

        }  catch (ServiceException e){
            e.printStackTrace();
            resultJson.setMsg(e.getMsg());
            resultJson.setStatus(ResultEnum.RESULT_ERROR.getStatus());
        } catch (UnknownAccountException e){
            e.printStackTrace();
            resultJson.setMsg("用户不存在");
            resultJson.setStatus(ResultEnum.RESULT_ERROR.getStatus());
            return resultJson;
        } catch (IncorrectCredentialsException e){
            e.printStackTrace();
            resultJson.setMsg("用户名或密码错误");
            resultJson.setStatus(ResultEnum.RESULT_ERROR.getStatus());
        } catch (LockedAccountException e){
            e.printStackTrace();
            resultJson.setMsg("账号被锁定，请联系管理员");
            resultJson.setStatus(ResultEnum.RESULT_ERROR.getStatus());
        } catch (DisabledAccountException e){
            e.printStackTrace();
            resultJson.setMsg("账号被禁用，请联系管理员");
            resultJson.setStatus(ResultEnum.RESULT_ERROR.getStatus());
        } catch (AuthenticationException e) {
            e.printStackTrace();
            resultJson.setMsg(e.getMessage());
            resultJson.setStatus(ResultEnum.RESULT_ERROR.getStatus());
        }

        return resultJson;
    }


    /**
     * 退出登录
     * @return 跳转到用户登录页面
     */
    @RequestMapping("/logout.php")
    public String logout(){
        Subject subject = SecurityUtils.getSubject();
        subject.logout();
        return "/login/loginUser";
    }


    /**
     * 新增用户 -- 内部用户添加
     * @param user 用户
     * @param file 文件
     * @return
     */
    @RequestMapping(value = "/addUser.php", method = RequestMethod.POST)
    @ResponseBody
    @RequiresPermissions("user:sys.user:add")
    public ResultJson addUser(User user, @RequestParam(value = "imgUserFile",required = false)MultipartFile file, HttpServletRequest request){
        try {

            if (user == null){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "请填写用户数据", null);
            }
            String postId = request.getParameter("postId");
            if (CommonUtils.checkNull(postId)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "岗位数据缺失，请重新登录后重试", null);
            }
            userService.addAutonomousUser(user, file, postId);
            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "用户添加成功", null);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "新增用户失败", null);
        }
    }

    /**
     * 注册一个用户 -- 用户自注册
     * @param user 用户
     * @param file 头像文件
     * @return
     */
    @RequestMapping(value = "/registerUser", method = RequestMethod.POST)
    @ResponseBody
    public String registerUser(User user, @RequestParam(value = "imgHredFile", required = false)MultipartFile file, HttpServletRequest request){
        ResultJson resultJson = new ResultJson();
        Gson gson = new Gson();

        if (user == null){
            resultJson.setMsg("请填写用户数据");
            resultJson.setStatus(ResultEnum.RESULT_ERROR.getStatus());
            return gson.toJson(resultJson);
        }

        //从前端获取验证码
        String verifyCode = request.getParameter("verifyCode");
        //获取存放在session中的验证码
        String randomString = (String) request.getSession().getAttribute(Constant.VERIFY_CODE);

        if (CommonUtils.checkNull(verifyCode) || CommonUtils.checkNull(randomString)){
            resultJson.setMsg("验证码为空或验证码已失效");
            resultJson.setStatus(ResultEnum.RESULT_ERROR.getStatus());
            return gson.toJson(resultJson);
        }
        if (!verifyCode.toUpperCase().equals(randomString.toUpperCase())){
            resultJson.setMsg("验证码错误或验证码失效");
            resultJson.setStatus(ResultEnum.RESULT_ERROR.getStatus());
            return gson.toJson(resultJson);
        }


        try {
            userService.addUser(user, file);
            resultJson.setMsg("用户添加成功");
            resultJson.setStatus(ResultEnum.RESULT_SUCCESS.getStatus());

        } catch (ServiceException e) {
            e.printStackTrace();
            resultJson.setMsg(e.getMsg());
            resultJson.setStatus(ResultEnum.RESULT_ERROR.getStatus());
        } catch (Exception e) {
            e.printStackTrace();
            resultJson.setMsg("用户添加失败");
            resultJson.setStatus(ResultEnum.RESULT_ERROR.getStatus());
        }

        return gson.toJson(resultJson);
    }

    /**
     * 获取验证码
     */
    @RequestMapping(value = "getVerifyCode", method = RequestMethod.GET)
    public void getVerifyCode(HttpServletRequest request, HttpServletResponse response){
        try {
            VerifyCodeUtil.creatImage(request, response);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * 跳转到用户注册页面
     * @return
     */
    @RequestMapping(value = "/regUserUrl", method = RequestMethod.GET)
    public String regUserUrl(ModelMap modelMap){
        return "/login/regUser";
    }

    /**
     * 跳转到用户登录页面
     * @return
     */
    @RequestMapping(value = "/loginUserUrl", method = RequestMethod.GET)
    public String loginUserUrl(){
        return "/login/loginUser";
    }

    /**
     * 跳转到未授权页面
     * @return
     */
    @RequestMapping("/noAuthorizedUrl")
    public String noAuthorizedUrl(){
        return "/common/noAuthorized";
    }


    /**
     * 跳转到用户注册|编辑|查看页面
     * @param modelMap
     * @param userId 用户主键
     * @param postId 岗位主键
     * @param type 类型：1 查看 2 修改 3 添加
     * @return
     * @throws ControllerException
     */
    @GetMapping("/operatingUser")
    public String operatingUserUrl(ModelMap modelMap, String userId, String postId, String type) throws ControllerException {
        if (CommonUtils.checkNull(userId) || CommonUtils.checkNull(postId) || CommonUtils.checkNull(type)){
            throw new ControllerException("参数有误，请刷新后重试");
        }

        User user = userService.getUserById(userId);
        //对一些附加参数进行处理
        String levelAdministrative = user.getLevelAdministrative();
        if (!CommonUtils.checkNull(levelAdministrative)){
            BaseInfo baseInfoLevelAdministrative = baseInfoService.getBaseInfoById(levelAdministrative);
            modelMap.put("baseInfoLevelAdministrative", baseInfoLevelAdministrative);
        }
        String administrativeType = user.getAdministrativeType();
        if (!CommonUtils.checkNull(administrativeType)){
            BaseInfo baseInfoAdministrativeType = baseInfoService.getBaseInfoById(administrativeType);
            modelMap.put("baseInfoAdministrativeType", baseInfoAdministrativeType);
        }
        String ethnic = user.getEthnic();
        if (!CommonUtils.checkNull(ethnic)){
            BaseInfo baseinfoEthnic = baseInfoService.getBaseInfoById(ethnic);
            modelMap.put("baseinfoEthnic", baseinfoEthnic);
        }


        Post post = postService.getPostById(postId);
        modelMap.put("userEdit", user);
        modelMap.put("post", post);
        modelMap.put("viewType", type);
        return "/main/mainUser";
    }


    /**
     * 更新 用户
     * @param user 用户
     * @param file 图片文件
     * @param request
     * @return
     */
    @RequestMapping(value = "/updateUser.php", method = RequestMethod.POST)
    @ResponseBody
    @RequiresPermissions("user:sys.user:upd")
    public ResultJson updateUser(User user, @RequestParam(value = "imgUserFile", required = false)MultipartFile file, HttpServletRequest request){
        try {

            if (user == null){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "请填写用户数据", null);
            }
            String userId = request.getParameter("userId");
            if (CommonUtils.checkNull(userId)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "用户id丢失", null);
            }
            user.setId(userId);
            String postId = request.getParameter("postId");
            if (CommonUtils.checkNull(postId)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "岗位数据缺失，请重新登录后重试", null);
            }
            userService.updateUser(user, file, postId);
            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "用户更新成功", null);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "更新用户失败", null);
        }
    }

    /**
     * 删除用户
     * @param userId 用户id
     * @param postId 岗位id
     * @return
     */
    @RequestMapping(value = "/delUser.php", method = RequestMethod.POST)
    @ResponseBody
    @RequiresPermissions("user:sys.user:del")
    public ResultJson delUser(String userId, String postId){
        try {

            if (CommonUtils.checkNull(postId) || CommonUtils.checkNull(userId)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "数据缺失，请重新登录后重试", null);
            }
            userService.delUser(userId, postId);
            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "用户删除成功", null);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "删除用户失败", null);
        }
    }

    /**
     * 跳转到嘉奖信息页面
     * @param userId 用户id
     * @param postId 岗位id
     * @return
     */
    @RequestMapping(value = "/commendUrl.php", method = RequestMethod.GET)
    public String commendUrl(String userId, String postId, ModelMap modelMap) throws ControllerException {
        if (CommonUtils.checkNull(userId) || CommonUtils.checkNull(postId)){
            throw new ControllerException("非法请求");
        }

        modelMap.put("userId", userId);
        modelMap.put("postId", postId);
        return "/main/commend";
    }

    /**
     * 获取嘉奖信息
     * @param page 页码
     * @param limit 每页数量
     * @param userId 用户id
     */
    @RequestMapping(value = "/getCommendList.php", method = RequestMethod.POST)
    @ResponseBody
    public ResultJson getCommendList(Integer page, Integer limit, String userId){
        try {
            if (CommonUtils.checkNull(userId)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "没有用户信息", null);
            }

            if (page == null || limit == null || page < 0 || limit < 0){
                PageHelper.startPage(1, 10);
            } else {
                //这段代码表示，程序开始分页了，page默认值是1，pageSize默认是10，意思是从第1页开始，每页显示10条记录
                PageHelper.startPage(page, limit);
            }
            List<Commend> commendList = commendService.getCommendByUserId(userId);
            PageInfo<Commend> pageInfo = new PageInfo<Commend>(commendList);
            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "获取嘉奖信息成功", pageInfo);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "获取嘉奖信息失败", null);
        }
    }

    /**
     * 嘉奖信息详情
     * @param id 嘉奖信息的主键
     * @return
     */
    @RequestMapping(value = "/detailedCommend.php", method = RequestMethod.POST)
    @ResponseBody
    public ResultJson detailedCommend(String id){
        try {

            if (CommonUtils.checkNull(id)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "数据缺失，请重新登录后重试", null);
            }

            Commend commend = commendService.getCommendById(id);
            //对数据进行转换处理

            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "获取嘉奖信息详情成功", commend);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "获取嘉奖信息详情失败", null);
        }
    }

    /**
     * 新增|修改 嘉奖信息
     * @param commend 嘉奖信息
     * @return
     */
    @RequestMapping(value = "/addOrUpdateCommend.php", method = RequestMethod.POST)
    @ResponseBody
    @RequiresPermissions(value = {"user:sys.commend:add", "user:sys.commend:upd"}, logical = Logical.OR)
    public ResultJson addOrUpdateCommend(Commend commend){
        try {

            if (commend == null){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "请填写嘉奖信息", null);
            }

            //如果嘉奖信息id不存在则是新增，否则则是更新
            if (CommonUtils.checkNull(commend.getId())){
                commendService.addCommend(commend);
                return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "嘉奖信息新增成功", commend);

            } else {
                commendService.updateCommend(commend);
                return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "嘉奖信息修改成功", commend);
            }


        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "嘉奖信息新增失败", null);
        }
    }

    /**
     * 获取 要更新的嘉奖信息
     * @param id 嘉奖信息主键
     * @return
     */
    @RequestMapping(value = "/updateCommendUrl.php", method = RequestMethod.POST)
    @ResponseBody
    @RequiresPermissions("user:sys.commend:upd")
    public ResultJson updateCommendUrl(String id){
        try {

            if (CommonUtils.checkNull(id)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "嘉奖信息主键为空", null);
            }

            Commend commend = commendService.getCommendById(id);
            if (commend == null){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "找不到嘉奖信息", null);
            }

            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "嘉奖信息获取成功", commend);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "嘉奖信息获取失败", null);
        }

    }

    /**
     * 删除 嘉奖信息
     * @param id 嘉奖id
     */
    @RequestMapping(value = "/delCommend.php", method = RequestMethod.POST)
    @ResponseBody
    @RequiresPermissions("user:sys.commend:del")
    public ResultJson delCommend(String id){
        try {

            if (CommonUtils.checkNull(id)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "嘉奖信息主键为空", null);
            }

            commendService.delCommend(id);

            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "嘉奖信息删除成功", null);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "嘉奖信息删除失败", null);
        }
    }


    /**
     * 跳转到违纪信息页面
     * @param userId 用户id
     * @param postId 岗位id
     * @return
     */
    @RequestMapping(value = "/punishUrl.php", method = RequestMethod.GET)
    public String punishUrl(String userId, String postId, ModelMap modelMap) throws ControllerException {
        if (CommonUtils.checkNull(userId) || CommonUtils.checkNull(postId)){
            throw new ControllerException("非法请求");
        }

        modelMap.put("userId", userId);
        modelMap.put("postId", postId);
        return "/main/punish";
    }


    /**
     * 获取违纪信息
     * @param page 页码
     * @param limit 每页数量
     * @param userId 用户id
     */
    @RequestMapping(value = "/getPunishList.php", method = RequestMethod.POST)
    @ResponseBody
    public ResultJson getPunishList(Integer page, Integer limit, String userId){
        try {
            if (CommonUtils.checkNull(userId)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "没有用户信息", null);
            }

            if (page == null || limit == null || page < 0 || limit < 0){
                PageHelper.startPage(1, 10);
            } else {
                //这段代码表示，程序开始分页了，page默认值是1，pageSize默认是10，意思是从第1页开始，每页显示10条记录
                PageHelper.startPage(page, limit);
            }
            List<Punish> punishList = punishService.getPunishByUserIdPubilc(userId, null);
            PageInfo<Punish> pageInfo = new PageInfo<Punish>(punishList);
            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "获取违纪信息成功", pageInfo);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "获取违纪信息失败", null);
        }
    }


    /**
     * 违纪信息详情
     * @param id 违纪信息的主键
     * @return
     */
    @RequestMapping(value = "/detailedPunish.php", method = RequestMethod.POST)
    @ResponseBody
    public ResultJson detailedPunish(String id){
        try {

            if (CommonUtils.checkNull(id)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "数据缺失，请重新登录后重试", null);
            }

            Punish punish = punishService.getPunishById(id);
            //对数据进行转换处理

            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "获取违纪信息详情成功", punish);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "获取违纪信息详情失败", null);
        }
    }


    /**
     * 新增|修改 违纪信息
     * @param punish 违纪信息
     * @return
     */
    @RequestMapping(value = "/addOrUpdatePunish.php", method = RequestMethod.POST)
    @ResponseBody
    @RequiresPermissions(value = {"user:sys.punish:add", "user:sys.punish:upd"}, logical = Logical.OR)
    public ResultJson addOrUpdatePunish(Punish punish){
        try {

            if (punish == null){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "请填写违纪信息", null);
            }

            //如果嘉奖信息id不存在则是新增，否则则是更新
            if (CommonUtils.checkNull(punish.getId())){
                punishService.addPunish(punish);
                return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "违纪信息新增成功", punish);

            } else {
                punishService.updatePunish(punish);
                return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "违纪信息修改成功", punish);
            }


        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "违纪信息新增失败", null);
        }
    }


    /**
     * 删除 违纪信息
     * @param id 违纪id
     */
    @RequestMapping(value = "/delPunish.php", method = RequestMethod.POST)
    @ResponseBody
    @RequiresPermissions("user:sys.punish:del")
    public ResultJson delPunish(String id){
        try {

            if (CommonUtils.checkNull(id)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "违纪信息主键为空", null);
            }

            punishService.delPunish(id);

            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "违纪信息删除成功", null);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "违纪信息删除失败", null);
        }
    }




    /**
     * 跳转到履历信息页面
     * @param userId 用户id
     * @param postId 岗位id
     * @return
     */
    @RequestMapping(value = "/resumeUrl.php", method = RequestMethod.GET)
    public String resumeUrl(String userId, String postId, ModelMap modelMap) throws ControllerException {
        if (CommonUtils.checkNull(userId) || CommonUtils.checkNull(postId)){
            throw new ControllerException("非法请求");
        }

        modelMap.put("userId", userId);
        modelMap.put("postId", postId);
        return "/main/resume";
    }


    /**
     * 获取履历信息
     * @param page 页码
     * @param limit 每页数量
     * @param userId 用户id
     */
    @RequestMapping(value = "/getResumeList.php", method = RequestMethod.POST)
    @ResponseBody
    public ResultJson getResumeList(Integer page, Integer limit, String userId){
        try {
            if (CommonUtils.checkNull(userId)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "没有用户信息", null);
            }

            if (page == null || limit == null || page < 0 || limit < 0){
                PageHelper.startPage(1, 10);
            } else {
                //这段代码表示，程序开始分页了，page默认值是1，pageSize默认是10，意思是从第1页开始，每页显示10条记录
                PageHelper.startPage(page, limit);
            }
            List<Resume> resumeList = resumeService.getResumeByUserIdPubilc(userId, null);
            PageInfo<Resume> pageInfo = new PageInfo<Resume>(resumeList);
            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "获取履历信息成功", pageInfo);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "获取履历信息失败", null);
        }
    }


    /**
     * 履历信息详情
     * @param id 违纪信息的主键
     * @return
     */
    @RequestMapping(value = "/detailedResume.php", method = RequestMethod.POST)
    @ResponseBody
    public ResultJson detailedResume(String id){
        try {

            if (CommonUtils.checkNull(id)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "数据缺失，请重新登录后重试", null);
            }

            Resume resume = resumeService.getResumeById(id);
            //对数据进行转换处理

            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "获取履历信息详情成功", resume);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "获取履历信息详情失败", null);
        }
    }

    /**
     * 新增|修改 履历信息
     * @param resume 履历信息
     * @return
     */
    @RequiresPermissions(value = {"user:sys.resume:add", "user:sys.resume:upd"}, logical = Logical.OR)
    @RequestMapping(value = "/addOrUpdateResume.php", method = RequestMethod.POST)
    @ResponseBody
    public ResultJson addOrUpdateResume(Resume resume){
        try {

            if (resume == null){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "请填写履历信息", null);
            }

            //如果嘉奖信息id不存在则是新增，否则则是更新
            if (CommonUtils.checkNull(resume.getId())){
                resumeService.addResume(resume);
                return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "履历信息新增成功", resume);

            } else {
                resumeService.updateResume(resume);
                return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "履历信息修改成功", resume);
            }


        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "履历信息新增失败", null);
        }
    }


    /**
     * 删除 履历信息
     * @param id 履历id
     */
    @RequestMapping(value = "/delResume.php", method = RequestMethod.POST)
    @ResponseBody
    @RequiresPermissions("user:sys.resume:del")
    public ResultJson delResume(String id){
        try {

            if (CommonUtils.checkNull(id)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "履历信息主键为空", null);
            }

            resumeService.delResume(id);

            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "履历信息删除成功", null);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "履历信息删除失败", null);
        }
    }



    /**
     * 跳转到 用户 图片界面
     * @param userId 用户id
     * @param postId 岗位id
     * @return
     */
    @RequestMapping(value = "/imgUrl.php", method = RequestMethod.GET)
    public String imgUrl(String userId, String postId, ModelMap modelMap) throws ControllerException {
        if (CommonUtils.checkNull(userId) || CommonUtils.checkNull(postId)){
            throw new ControllerException("非法请求");
        }

        modelMap.put("userId", userId);
        modelMap.put("postId", postId);
        return "/main/imgUser";
    }

    /**
     * 用户图片上传
     *      可以用多种方式：
     *          第一种：利用MultipartFile[]作为方法的参数接收传入的文件，用 transferTo方法来保存图片，保存到本地磁盘。
     *          第二种：利用MultipartHttpServletRequest来解析request中的文件，解析的话可以用 multiRequest.getFiles("file");来获取里面的文件，然后遍历files，也可以直接转
     *              文件map
     *          第三种：使用MultipartFile作为方法参数接收传入的文件（单文件上传的时候可以用）
     * @param request
     * @return
     */
    @RequestMapping(value = "/addImg.php", method = RequestMethod.POST)
    @ResponseBody
    @RequiresPermissions("user:sys.img:add")
    public ResultJson addImg(HttpServletRequest request){
        try {

            String userId = request.getParameter("userId");
            if (CommonUtils.checkNull(userId)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "找不到用户数据", null);
            }

            userImgService.addImg(userId, request);

            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "上传图片成功", null);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "上传图片失败", null);
        }
    }


    /**
     * 获取 图片信息
     * @param page 页码
     * @param limit 每页数量
     * @param userId 用户id
     */
    @RequestMapping(value = "/getUserImgList.php", method = RequestMethod.GET)
    @ResponseBody
    public ResultJson getUserImgList(Integer page, Integer limit, String userId){
        try {
            if (CommonUtils.checkNull(userId)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "没有用户信息", null);
            }

            if (page == null || limit == null || page < 0 || limit < 0){
                PageHelper.startPage(1, 10);
            } else {
                //这段代码表示，程序开始分页了，page默认值是1，pageSize默认是10，意思是从第1页开始，每页显示10条记录
                PageHelper.startPage(page, limit);
            }
            List<UserImg> userImgList = userImgService.getUserImgList(userId);
            PageInfo<UserImg> pageInfo = new PageInfo<UserImg>(userImgList);
            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "获取图片信息成功", pageInfo);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "获取图片信息失败", null);
        }
    }


    /**
     * 获取用户图
     * @param id 图片的id
     * @param response
     */
    @RequestMapping("/getUserImg")
    public void getUserImg(String id, HttpServletResponse response){
        if (id == null){
            return;
        }
        UserImg userImg = userImgService.getUserImgByUrlAddr(id);
        String userId = userImg.getUserId();
        User user = userService.getUserById(userId);
        if (user != null){
            ImgUtils.readImg(id, response, "imgUserBase", user.getLogName());
        }
    }


    /**
     * 用户图片信息详情
     * @param id 用户图片的主键
     * @return
     */
    @RequestMapping(value = "/detailedUserImg.php", method = RequestMethod.POST)
    @ResponseBody
    public ResultJson detailedUserImg(String id){
        try {

            if (CommonUtils.checkNull(id)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "找不到ID", null);
            }

            UserImg userImg = userImgService.getUserImgById(id);
            //对数据进行转换处理

            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "获取用户图片信息详情成功", userImg);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "获取用户图片信息详情失败", null);
        }
    }

    /**
     * 根据图片id删除图片
     * @param id 图片主键
     * @return
     */
    @RequestMapping(value = "/delUserImg.php", method = RequestMethod.GET)
    @ResponseBody
    @RequiresPermissions("user:sys.img:del")
    public ResultJson delUserImg(String id){
        try {

            if (CommonUtils.checkNull(id)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "请选择图片后在删除", null);
            }

            userImgService.delUserImg(id);

            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "删除图片成功", null);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "删除图片失败", null);
        }
    }



    /**
     * 跳转到 用户 关系界面
     * @param userId 用户id
     * @param postId 岗位id
     * @return
     */
    @RequestMapping(value = "/relationshipUrl.php", method = RequestMethod.GET)
    public String relationshipUrl(String userId, String postId, ModelMap modelMap) throws ControllerException {
        if (CommonUtils.checkNull(userId) || CommonUtils.checkNull(postId)){
            throw new ControllerException("非法请求");
        }

        User user = userService.getUserById(userId);
        modelMap.put("userRelation", user);
        modelMap.put("userId", userId);
        modelMap.put("postId", postId);
        return "/main/subsidiaryUser";
    }

    /**
     * 跳转到新增机构|部门
     * @param id 上级机构的机构id
     * @param name 上级机构的机构名
     * @param name 上级机构的机构名
     * @param type 操作类型 1 新增 2 修改 3 新增父级部门
     * @param modelMap
     * @return
     * @throws ControllerException
     */
    @GetMapping(value = "addOrUpdOrgUrl.php")
    public String addOrUpdOrgUrl(String id, String name, ModelMap modelMap, String type) throws ControllerException{
        if (CommonUtils.checkNull(id) || CommonUtils.checkNull(name)){
            throw new ControllerException("非法请求");
        }

        //管辖机构名
        String nameStr = "";
        modelMap.put("operateType", type);

        if ("2".equals(type)){
            Organization organization = organizationService.getOrganizationById(id);
            if (organization == null){
                throw new ControllerException("更新的机构|部门不存在，请刷新后重试");
            }
            modelMap.put("organizationEdit", organization);
            modelMap.put("fatherorgNode", organization.getFatherorgNode());
            modelMap.put("fatherorgName", organization.getFatherorgName());

            String fatherorgNode = organization.getFatherorgNode();
            Organization father = organizationService.getOrganizationById(fatherorgNode);
            if (father != null){
                nameStr = father.getName();
            }

            //一些参数的转换
            String fatherNode = organization.getFatherNode();
            if (!CommonUtils.checkNull(fatherNode)){
                Organization fatherOrg = organizationService.getOrganizationById(fatherNode);
                if (fatherOrg != null){
                    modelMap.put("fatherNode", fatherOrg.getName());
                }
            }
            String secretGrade = organization.getSecretGrade();
            if (!CommonUtils.checkNull(secretGrade)){
                BaseInfo baseInfoSecretGrade = baseInfoService.getBaseInfoById(secretGrade);
                if (baseInfoSecretGrade != null){
                    modelMap.put("baseInfoSecretGrade", baseInfoSecretGrade.getKey());
                }
            }
            String orgType = organization.getOrgType();
            if (!CommonUtils.checkNull(orgType)){
                BaseInfo baseInfoOrgType = baseInfoService.getBaseInfoById(orgType);
                if (baseInfoOrgType != null){
                    modelMap.put("baseInfoOrgType", baseInfoOrgType.getKey());
                }
            }
            String levelAdministrative = organization.getLevelAdministrative();
            if (!CommonUtils.checkNull(levelAdministrative)){
                BaseInfo baseInfoLevelAdministrative = baseInfoService.getBaseInfoById(levelAdministrative);
                if (baseInfoLevelAdministrative != null){
                    modelMap.put("baseInfoLevelAdministrative", baseInfoLevelAdministrative.getKey());
                }
            }

        } else if ("3".equals(type)){
            Organization organization = organizationService.getOrganizationById(id);
            if (organization == null){
                throw new ControllerException("机构|部门不存在，请刷新后重试");
            }
            modelMap.put("fatherorgNode", organization.getFatherorgNode());
            modelMap.put("fatherorgName", organization.getFatherorgName());
            modelMap.put("sonId", id);
            String fatherorgNode = organization.getFatherorgNode();
            Organization father = organizationService.getOrganizationById(fatherorgNode);
            if (father != null){
                nameStr = father.getName();
            }

        } else {
            if (!Constant.ORG_BASE.equals(id)) {
                nameStr = name;
            }
            modelMap.put("fatherorgNode", id);
            modelMap.put("fatherorgName", name);
        }

        modelMap.put("nameStr", nameStr);


        return "/main/mainOrg";
    }


    /**
     * 添加或修改用户附属子用户数据
     * @param subsidiaryUser 隶属主用户的子用户数据
     * @param relationship 关系表
     * @param file 用户头像
     * @param subsidiaryUserId 更新时候用到的子用户ID
     * @return
     */
    @RequiresPermissions(value = {"user:sys.sonUser:upd", "user:sys.sonUser:add"}, logical = Logical.OR)
    @RequestMapping(value = "/addOrUpdSubsidiaryUser.php", method = RequestMethod.POST)
    @ResponseBody
    public ResultJson addOrUpdSubsidiaryUser(String subsidiaryUserId, String relationshipId, @RequestParam(value = "imgSubsidiaryFile")MultipartFile file, SubsidiaryUser subsidiaryUser, Relationship relationship, HttpServletRequest request){
        try {

            if (subsidiaryUser == null){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "请输入用户数据", null);
            }
            if (relationship == null){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "请输入用户关系数据", null);
            }
            if (!CommonUtils.checkNull(subsidiaryUserId)){
                subsidiaryUser.setId(subsidiaryUserId);
            }
            if (!CommonUtils.checkNull(relationshipId)){
                relationship.setId(relationshipId);
            }

            subsidiaryUserService.addOrUpdSubsidiaryUser(file, subsidiaryUser, relationship, request);

            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "成功", null);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "失败", null);
        }
    }


    /**
     * 递归获取指定用户附加用户数据
     * @param userId 要查询的用户的ID，user.id
     * @return
     */
    @RequestMapping(value = "/getUserRelattionship.php", method = RequestMethod.GET)
    @ResponseBody
    public ResultJson getUserRelattionship(String userId){
        try {

            if (CommonUtils.checkNull(userId)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "用户ID为空", null);
            }
            SubsidiaryUser subsidiaryUser = subsidiaryUserService.getUserRelattionship(userId);

            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "查询成功", subsidiaryUser);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "查询失败", null);
        }

    }

    /**
     * 根据主键删除子用户
     * @param id 子用户主键
     * @return
     */
    @RequiresPermissions("user:sys.sonUser:del")
    @RequestMapping(value = "/delSubsidiaryUser.php", method = RequestMethod.GET)
    @ResponseBody
    public ResultJson delSubsidiaryUser(String id){
        try {

            if (CommonUtils.checkNull(id)){
                return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "ID不能为空", null);
            }

            subsidiaryUserService.delSubsidiaryUser(id);
            return new ResultJson(null, ResultEnum.RESULT_SUCCESS.getStatus(), "删除成功", null);

        } catch (ServiceException e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), e.getMsg(), null);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultJson(null, ResultEnum.RESULT_ERROR.getStatus(), "删除失败", null);
        }

    }



}
